import {action, observable} from 'mobx';
import * as API_FORWARD from '../apis/forward';
import {WeaForm} from 'comsMobx';
import {Modal} from 'antd';
import uniqBy from 'lodash/uniqBy';
import {WeaLocaleProvider, WeaTools} from 'ecCom';
import {getSecondAuthConfig} from "../apis/secondAuth";
import * as authTypes from "../constants/secondAuthType";

const getLabel = WeaLocaleProvider.getLabel;

export default class WFForwardStore {
    @observable  loading = false;
    @observable  isClear = false;
    @observable selectOperatorsMax = 100; //转发人数最大限制，默认100
    @observable signinput = {};
    @observable loaded = false;
	@observable isshowoperategroup = false;
	@observable isshownodeoperators = false;
	@observable isdisabledbtns = false;
	@observable operatorDatas  = [];
	@observable formParams = {
		IsSubmitedOpinion:'1',
		IsBeForwardTodo:'1',
		field5:'',
        isShowReplyNotice : 0,
		takOverMins : 30
    }
    @observable isFormSignature;
	initRemarkContent = false;
    //转发
    @observable showForward = false; 
    fromform = false;
    //节点操作者
    submititems = [];
    unsubmititems = [];
    @observable allitems = [];
    @observable operatorname = '';

    @observable callBackActions = {};
    @observable addGroupForm = new WeaForm();

    addFormConditions = [];
    @observable hrmgroups = [];

    @observable remarkMap = observable.map ? observable.map({}) : asMap({});  //签字意见引用列表
	@observable hrmSqlWhere = "";//人力资源浏览按钮的sqlwhere
	@observable remindInfo = {}; //提醒
	@observable remindTypes = ''; //
    @observable fwLimitInfo = {}; //转发、转办、意见征询范围设置信息
    @observable replyNoticeInfo = {};  //转发接收人批注后提醒我

    chuanyueInfo = {};//传阅

    secondAuthStore = null;		//二次验证的store

    secondAuthParams = {};      //二次验证需要的一些参数

    filterRequestAction = null;     //过滤流程操作类型的方法(转发、转办、征询等）

    showAuthDialog = null;      //打开二次认证窗口的方法

    closeForwarDialog = null;		//关闭转发的窗口，因为有2个参数控制窗口的显示/隐藏，因此需要这个方法也调用


    @observable ops="";

    @observable groupId="";

    @observable groupType="";

    @observable addGroupModalVisible=false;

    constructor() {
    	this.setShowForward  = this.setShowForward;
    	this.initData  = this.initData;
    	this.handleVisibleChange = this.handleVisibleChange;
    	this.handleShowNodeOperator = this.handleShowNodeOperator;
    	this.setOperatorIds = this.setOperatorIds;
    	this.dropAllUserGroup = this.dropAllUserGroup;
    	this.setFormParams  = this.setFormParams;
    	this.setOperatorDatas = this.setOperatorDatas;
    	this.clearSignInput = this.clearSignInput;
		this.doSubmitPost = this.doSubmitPost;
		this.showNodeAllOperatorName = this.showNodeAllOperatorName;
		this.controllAddModal = this.controllAddModal
		this.saveGroup = this.saveGroup;
		this.updateRemindType = this.updateRemindType;
        this.setOptParams = this.setOptParams;
    }

    @action
   	setShowForward = (params={},callBackActions = {})  => {
        if(!("showForward" in params))
            return;
    	const {showForward = false,fromform = false,forwardOperators,forwardflag='1',isClickCloseBtn = false} = params;
		if(showForward) {
			this.initRemarkContent = true;
		}
		this.showForward = showForward;
		this.fromform =  fromform;
		if(callBackActions) {
            this.callBackActions  = callBackActions;
		}
		delete params['showForward'];
        delete params['fromform'];
        delete params['isClickCloseBtn'];

        const forwardSubmitTokeyKey = `forward_token_${params.requestid}_${params.f_weaver_belongto_userid}`;
        params[forwardSubmitTokeyKey] = new Date().getTime();

        this.setFormParams(params);
		if(!this.loaded && showForward) {
			this.initData();
		}
        if(forwardOperators && forwardOperators != '') {
            this.setOperatorIds({
                ids: forwardOperators,
                isAllUser: false,
                isLoad: true
            });
        }
        const updateparams  = {isClear:false,initRemarkContent:true};
        if(forwardflag === '3') {
            updateparams.operatorDatas = [];
            updateparams.field5 = '';
        }

		if(!showForward) {
			this.initRemarkContent = false;
			if(this.operatorname != '') this.operatorname = '';
			this.clearSignInput(isClickCloseBtn);
		}
	}

    setSecondAuthParams = (params, secondAuthStore, filterRequestAction, closeForwarDialog, showAuthDialog)  => {
        this.secondAuthParams = params ? params : null;
        this.secondAuthStore = secondAuthStore ? secondAuthStore : null;
        this.filterRequestAction = filterRequestAction && typeof filterRequestAction == "function" ? filterRequestAction : null;
        this.closeForwarDialog = closeForwarDialog && typeof closeForwarDialog == "function" ? closeForwarDialog : null;
        this.showAuthDialog = showAuthDialog && typeof showAuthDialog == "function" ? showAuthDialog : null;
    }

    @action
    initData = () =>  {
    	const {requestid = -1,workflowid='',nodeid='',forwardflag=''} = this.formParams;
   		API_FORWARD.getSignInput(this.formParams).then((datas)=>{
			const {IsSubmitedOpinion,IsBeForwardTodo,chuanyueInfo = {}} = datas;
			const {isSubmitSign = '0', isChuanyue = '0', isRemind = '0'} = chuanyueInfo;  
            this.setFormParams({IsSubmitedOpinion,IsBeForwardTodo,isSubmitSign,isChuanyue,isRemind});
            this.signinput = datas;
            this.isFormSignature=datas.isFormSignature;
			this.chuanyueInfo = chuanyueInfo;
   			this.loaded  = true;
   		});

   		API_FORWARD.getSelectMaxRight().then((data)=>{
   			this.selectOperatorsMax = data.right ? undefined : 100;
		});

		API_FORWARD.getOperators(requestid).then((data)=>{
			const {operators = []} = data;
			this.hrmSqlWhere = data.hrmSqlWhere;
			this.initNodeOperatorsData(operators);
		});

        API_FORWARD.loadRemindInfo({requestid : requestid}).then((data)=>{
            this.remindInfo = data;
            this.remindTypes = data.value;
        });
        forwardflag =='1' && API_FORWARD.getReplyNoticeInfo({requestid : requestid}).then((data)=>{
            this.replyNoticeInfo = data;
            this.setFormParams({isShowReplyNotice : data.replyNotice});
        });

        API_FORWARD.getFwLimitBrowserSet({type : 'canChoiceOperator',wfid:workflowid,nodeid:nodeid,fwtype:forwardflag}).then((data)=>{
            const {isopen = '',choiceoperator = ''} = data;
            this.fwLimitInfo = {isopen,choiceoperator};
        });

    }

    loadHrmGroupData=()=>{
        const {requestid = -1} = this.formParams;
        API_FORWARD.loadHrmGroupData({requestid : requestid}).then((data)=>{
        	const {datas =[]} = data;
            this.hrmgroups = datas;
        });
    }


    //控制常用组显示、及数据
    handleVisibleChange = (bool) =>  {
        this.initRemarkContent = false;
        this.isshowoperategroup = bool;
        this.isshownodeoperators = false;
        if(bool){
            this.loadHrmGroupData();
        }
        //this.setState({isshowoperategroup: bool,isshownodeoperators: false});
    }

    //控制
    handleShowNodeOperator = (bool) =>  {
        this.initRemarkContent = false;
        this.isshowoperategroup = false;
        this.isshownodeoperators = bool;
        //this.setState({isshowoperategroup: false,isshownodeoperators: bool});
    }

   	//更新操作者
	setOperatorIds = (params) =>  {
		this.initRemarkContent = false;
		if(params.isAllUser) {
			if(this.selectOperatorsMax) {
				if(params.count < this.selectOperatorsMax) {
					this.isdisabledbtns = true;
				}
			} else {
				this.isdisabledbtns = true;
			}
			const allUser = [{
				type: 'all',
				lastname: getLabel(1340,'所有人'),
				ids: params.ids,
				count: params.count,
				id: 'all_users'
			}];
			this.setOperatorDatas(allUser);
		} else {
			if(params.isLoad) {
				API_FORWARD.loadResources({types: params.ids}).then(data => {
					const {datas = []} = data;
					this.setOperatorDatas(datas);
				});
			} else {
				this.setOperatorDatas(params.datas);
			}
		}
	}

	dropAllUserGroup = () => {
		this.initRemarkContent = false;
		this.isdisabledbtns = false;
	}

	setFormParams = (updateParam) => {
		this.initRemarkContent = false;
		this.formParams = {...this.formParams,...updateParam};
	}

	setOperatorDatas = (datas) =>  {
		this.initRemarkContent = false;
		this.operatorDatas  = datas;
	}

    doSubmitPost = (params)  => {
        const secondAuthStore = this.secondAuthStore;
        const secondAuthParams = this.secondAuthParams;
        const filterRequestAction = this.filterRequestAction;
        const showAuthDialog = this.showAuthDialog;
        if (secondAuthStore && secondAuthParams && filterRequestAction && showAuthDialog) {
            const {workflowid, nodeid, requestid, f_weaver_belongto_userid, f_weaver_belongto_usertype} = secondAuthParams;
            const {isAuthSuccess, isProtectSuccess} = secondAuthStore;
            const $this = this;
            //已验证通过或者已数据保护通过
            if (isAuthSuccess == 1 || isProtectSuccess == 1) {
                const {isEnableAuth, secondAuthType, isEnableProtect, protectType} = secondAuthStore;
                const configParams = secondAuthStore.params;
                const {authKey, qysSignWay = 2} = configParams;     //qysSignWay: 1,契约锁ukey签署，2，契约锁服务签署

                if (isProtectSuccess != 1 && isEnableProtect == 1) {      //仍然需要数据保护
                    if (protectType == authTypes.CA_AUTH || (protectType == authTypes.QYS && qysSignWay == 1)) {     //CA认证
                        const isProtectDialog = 1;    //1表示打开的是CA数据保护的窗口
                        secondAuthStore.setCAAuthData({isProtectDialog});		//设置CA认证的数据
                        //弹出数据保护的窗口
                        secondAuthStore.setCallbackFunc($this.doSubmitPost);
                        secondAuthStore.setCallbackParam(params);
                        if((protectType == authTypes.CA_AUTH && secondAuthType == authTypes.QYS && qysSignWay == 1)
                            ||(secondAuthType == authTypes.CA_AUTH && protectType == authTypes.QYS && qysSignWay == 1)){
                            const {remark} = params;
                            getSecondAuthConfig({workflowid, nodeid, requestid, remark}).then(data => {
                                const {authKey, sourcestr} = data;
                                secondAuthStore.setCAAuthData({authKey, sourcestr});
                                secondAuthStore.setParams(data);
                                if (protectType == authTypes.QYS && qysSignWay == 1) {
                                    window.QYSUKeyUtil.showSignWin(secondAuthStore);
                                } else {
                                    showAuthDialog(authTypes.SECOND_AUTH_DIALOG);
                                }
                            });
                        }else{
                            if (protectType == authTypes.QYS && qysSignWay == 1) {
                                window.QYSUKeyUtil.showSignWin(secondAuthStore);
                            } else {
                                showAuthDialog(authTypes.SECOND_AUTH_DIALOG);
                            }
                        }
                        return;
                    } else if (protectType == authTypes.QYS && qysSignWay == 2) {     //契约锁数据保护
                        const isProtectDialog = 1;    //1表示打开的是契约锁数据保护的窗口
                        secondAuthStore.setCAAuthData({isProtectDialog});

                        //弹出验证或者数据保护的窗口
                        showAuthDialog(authTypes.SECOND_AUTH_DIALOG);
                        return;
                    }
                }
                //契约锁数据保护或者认证
                if (protectType == authTypes.QYS || secondAuthType == authTypes.QYS) {
                    const {params: authParams} = secondAuthStore;
                    const {qysSealId, qysSealImg, qysCertDetails} = authParams;
                    params = {...params, qysSealId, qysSealImg, qysCertDetails};
                }
                //能运行到这里，说明已经做完了数据保护
                if (isEnableProtect == 1) {
                    if (protectType == authTypes.CA_AUTH|| (protectType == authTypes.QYS && qysSignWay == 1)) {
                        params = {...params, authKey, isProtectSuccess};
                    }
                }

                params.protectType = protectType;
                params.secondAuthType = secondAuthType;
                params.isAuthSuccess = isAuthSuccess;
                params.isEnableProtect = isEnableProtect;
                params.qysSignWay = qysSignWay;

                this.doSubmitPost0(params);
            } else {
                const {remark} = params;
                getSecondAuthConfig({workflowid, nodeid, requestid, remark}).then(data => {
                    const {isEnableAuth = 0, secondAuthType = 0, isEnableProtect = 0, protectType = 0, qysSignWay = 2, authOperations = [], message = "", success} = data;

                    if (success == "0") {
                        if(!!message){
                            Modal.warning({
                                content: message,
                                okText: getLabel(83446, '确定'),
                                showClose: false
                            })

                            return;
                        }
                    }

                    const isNeedCheck = this.filterRequestAction(params, secondAuthParams, authOperations) || false;        //是否需要二次验证
                    if (isNeedCheck) {
                        secondAuthStore.setDialogData({isEnableAuth, secondAuthType, isEnableProtect, protectType});
                        if (isEnableAuth == 1) {        //二次认证
                            let isProtectDialog = 0;
                            //同时是CA认证和数据保护或者契约锁认证和数据保护
                            if ((secondAuthType == authTypes.CA_AUTH && isEnableProtect == 1 && protectType == authTypes.CA_AUTH)
                                || (secondAuthType == authTypes.QYS && isEnableProtect == 1 && protectType == authTypes.QYS)) {
                                isProtectDialog = 10;    //10表示打开的是CA二次认证+ CA数据保护的窗口 或者 契约锁二次认证 + 契约锁数据保护的窗口
                            }
                            secondAuthStore.setCAAuthData({isProtectDialog});		//设置CA认证的数据

                            if ((secondAuthType == authTypes.CA_AUTH || (protectType == authTypes.CA_AUTH&&isEnableProtect == 1))
                                    ||((secondAuthType == authTypes.QYS||(protectType == authTypes.QYS&&isEnableProtect == 1))&& qysSignWay == 1)){
                                const {authKey, sourcestr} = data;
                                secondAuthStore.setCAAuthData({authKey, sourcestr});
                            }

                            //弹出验证或者数据保护的窗口
                            secondAuthStore.setCallbackFunc($this.doSubmitPost.bind($this));
                            secondAuthStore.setCallbackParam(params);
                            secondAuthStore.setParams(data);

                            if (secondAuthType == authTypes.QYS && qysSignWay == 1) {
                                window.QYSUKeyUtil.showSignWin(secondAuthStore);
                            } else {
                                showAuthDialog(authTypes.SECOND_AUTH_DIALOG);
                            }
                        } else {     //没有开启二次认证
                            if (isEnableProtect == 1) {
                                //目前数据保护的方式只有2种：CA保护，契约锁保护
                                if (protectType == authTypes.CA_AUTH||(protectType == authTypes.QYS && qysSignWay == 1)) {       //CA认证的方式
                                    const isProtectDialog = 1;    //1表示打开的是CA数据保护的窗口
                                    const {authKey, sourcestr} = data;
                                    secondAuthStore.setCAAuthData({authKey, sourcestr, isProtectDialog});
                                } else {     //契约锁保护，也需要打开窗口，让用户选择签章
                                    const isProtectDialog = 1;    //1表示打开的是CA数据保护的窗口
                                    secondAuthStore.setCAAuthData({isProtectDialog});
                                }

                                //弹出验证或者数据保护的窗口
                                secondAuthStore.setCallbackFunc($this.doSubmitPost.bind($this));
                                secondAuthStore.setCallbackParam(params);
                                secondAuthStore.setParams(data);

                                if (protectType == authTypes.QYS && qysSignWay == 1) {
                                    window.QYSUKeyUtil.showSignWin(secondAuthStore);
                                } else {
                                    showAuthDialog(authTypes.SECOND_AUTH_DIALOG);
                                }
                            } else {
                                $this.doSubmitPost0(params);
                            }
                        }
                    } else {
                        $this.doSubmitPost0(params);
                    }
                });
            }
        } else {
            this.doSubmitPost0(params);
        }
    }

    doSubmitPost0 = (params) =>  {
        this.initRemarkContent = false;
        const _this = this;
        this.loading = true;
        const requestid = params.requestid;
        params = {...params,...{remindTypes : this.remindTypes}}
		const closeForwarDialog = this.closeForwarDialog;
        if(window.console) console.log("start forward submit",params);

        //提交的时候，把签字意见带进去
		API_FORWARD.forwardSubmit(params).then(data => {
            if(window.console) console.log("forward submit response data",data);
            _this.loading = false;
			const forwardflag = data.forwardflag;
            const mes = data.message;
			//重置store
            this.secondAuthStore && this.secondAuthStore.resetStore();

			if(_this.fromform) {
                const success = data.success;
                if(!success){
                	const msg = data.msg;
                    Modal.warning({
                        okText:getLabel(83446,'确定'),
                        onOk() {
                            try {
                                data.needReload && window.wfform.reloadPage()
                            } catch(e) {}
						},
                        content:msg
                    });
                	return ;
				}
				const {setTabKey,changeSubmitParam,wfListReLoad,batchControlVariableMap,closeRequestPage,refreshRightMenu} = this.callBackActions;
				if(forwardflag == '1' || forwardflag == '4') {
					typeof setTabKey === 'function' && setTabKey('form');
                    if(typeof batchControlVariableMap === 'function'){
						const reloadLogListParams = {pgnumber: 1,atmet: '',maxrequestlogid: 0};
                        batchControlVariableMap({'isRelaodLogList':true,'reloadLogListParams':reloadLogListParams});
					}
					// const {lastoperator,lastoperatedate,lastoperatetime} = data;
					// let updateinfo = {
					// 	lastOperator: lastoperator,
					// 	lastOperateDate: lastoperatedate,
					// 	lastOperateTime: lastoperatetime,
					// };
                    typeof refreshRightMenu === 'function' && refreshRightMenu({});
                    //typeof changeSubmitParam === 'function' && changeSubmitParam(updateinfo);
				} else {
                    let messsage = forwardflag == "2" ? getLabel('84512',"流程意见征询成功") : getLabel('84513',"流程转办成功");
                    if(forwardflag == '5') {
                        messsage = getLabel('513018',"征询转办成功");
                    }
					if(mes && mes != ""){
					    messsage = mes;
                    }
                    Modal.warning({
						content: messsage,
						okText: getLabel(83446,'确定'),
						showClose: false,
						onOk() {
                            typeof wfListReLoad === 'function' && wfListReLoad();
                            typeof closeRequestPage === 'function' && closeRequestPage(false);
						}
					})
				}
			} else {
				const {callBackfun} = this.callBackActions;
				typeof callBackfun === 'function' && callBackfun();
			}
            this.formParams['isShowReplyNotice'] = 0;
			_this.setShowForward({showForward:false,requestid:-1});
            closeForwarDialog && typeof closeForwarDialog == "function" && closeForwarDialog();
            
            try{
                window.wfform.changeFieldAttr('field-10', 1);//转发后，密级字段设置为只读
            } catch(e) {} 

		}).catch((e) =>{
            _this.loading = false;
            //message.error('提交失败,请重新提交',3);
        });
        if(window.console) console.log("forward end");
    }

    /**nodeoperator*/
    //初始化列表数据
    initNodeOperatorsData = (datas) =>  {
        let allitems = [];
        let submititems = [];
        let unsubmititems = [];
        datas && datas.map(o => {
            let f1 = true;
            let f2 = true;
            let f3 = true;
            let user = {
                'id': o.uid,
                'lastname': o.data,
                'jobtitlename': o.jobtitlename,
                'icon': o.icon,
                'type': 'resource',
                'departmentname': o.departmentname,
                'subcompanyname': o.subcompanyname,
                'supsubcompanyname': o.supsubcompanyname
            };
            allitems.map(a => {
				if(a.nodeid == o.nodeid) {
					a.users.push(user);
					a.names = a.names ? (a.names + '  ' + o.data) : o.data;
					f1 = false;
				}
			});
			if(f1) {
				allitems.push({
					'nodeid': o.nodeid,
					'nodename': o.nodename,
					'names': o.data,
					'users': [user]
				});
			}
			if(o.handed == '1') {
				submititems.map(b => {
					if(b.nodeid == o.nodeid) {
						b.users.push(user);
						b.names = b.names ? (b.names + '  ' + o.data) : o.data;
						f2 = false;
					}
				});
				if(f2) {
					submititems.push({
						'nodeid': o.nodeid,
						'nodename': o.nodename,
						'ids': o.uid,
						'names': o.data,
						'users': [user]
					});
				}
			}
			if(o.handed == '0') {
				unsubmititems.map(c => {
					if(c.nodeid == o.nodeid) {
						c.users.push(user);
						c.names = c.names ? (c.names + '  ' + o.data) : o.data;
						f3 = false;
					}
				});

				if(f3) {
					unsubmititems.push({
						'nodeid': o.nodeid,
						'nodename': o.nodename,
						'ids': o.uid,
						'names': o.data,
						'users': [user]
					});
				}
			}
		});

		this.submititems = this.removeDupUser(submititems);
		this.unsubmititems = this.removeDupUser(unsubmititems);
		this.allitems = this.removeDupUser(allitems);
	}

	removeDupUser = (items = []) =>{
        let result = [];
        items.map((item = {}) => {
            const {users} = item;
            item.users = uniqBy(users,'id');
            result.push(item);
        });
        return result;
    }

	showNodeAllOperatorName = (operatorname) => {
		this.operatorname = operatorname;
	}

    controllAddModal = (bool) => {
		if(bool){
            const {isFormInit} = this.addGroupForm;
            if(!isFormInit) {
                API_FORWARD.getHrmGroupForm({cmd:'base'}).then((data)=>{
                    const {conditions =[]} =data;
                    this.addFormConditions = conditions;
                    this.addGroupForm.initFormFields(conditions);
                    this.addGroupForm.updateFields({sn:{value:0.00}});
                });
			}
		}
		this.addGroupModalVisible = bool;
	}

    saveGroup = () => {
        const formParams = this.addGroupForm.getFormParams();
        const {requestid = -1 } = this.formParams;
        formParams.cmd = 'base';
        API_FORWARD.saveGroup(formParams).then((data)=>{
          	this.controllAddModal(false);
          	this.addGroupForm.resetConditionValue();
            this.loadHrmGroupData();
        });
	}

	clearSignInput = (isClickCloseBtn = false) => {
        this.loading = false;
		this.operatorDatas = [];
		this.forwardremark = '';
		const {remark,workflowRequestLogId} = this.formParams;
		let updateFormParams =  {
			field5: '',
            IsSubmitedOpinion: '1',
            IsBeForwardTodo: '1',
            isShowReplyNotice : this.formParams.isShowReplyNotice,
			takOverMins : 30
		};
		if(isClickCloseBtn) {
            updateFormParams['remark'] = remark;
            updateFormParams['workflowRequestLogId'] = workflowRequestLogId;
		}
		this.formParams = updateFormParams;
		this.isdisabledbtns = false;
        this.isClear = true;
        this.signinput = {};
		this.requestid = -1;
        this.loaded = false;
        this.remarkMap = observable.map ? observable.map({}) : asMap({});
    }
    
    @action("修改签字意见引用列表")
    setRemarkList = (value) => {
        let t = value ||(observable.map ? observable.map({}) : asMap({}))
        this.remarkMap = observable.map ? observable.map(t) : asMap(t);
    }

    @action('更新remindtype')
	updateRemindType = (v='') => {
		this.remindTypes = v;
    }
    
    @action("修改公共组私人组参数")
    setOptParams = (v={}) =>{
        Object.keys(v).forEach(key => {
            this[key] = v[key];
        });
    }

    opsHandler = (ops, e, item) => {        
        // const { dataParams = {} } = this;
        e.stopPropagation && e.stopPropagation();
        e.preventDefault && e.preventDefault();
        let optParams = {};
        if (ops == "delete") {
            Modal.confirm({
                title: getLabel(131329, "信息确认"),
                content: getLabel(385625, "确定要删除选择的记录吗？"),
                onOk: () => {
                    WeaTools.callApi("/api/hrm/group/delete", "POST", {
                        cmd: "base",
                        groupid: item.id,
                        // f_weaver_belongto_userid: dataParams.f_weaver_belongto_userid || ""
                    })
                        .then(res => {
                           //刷新组列表
                        })
                        .catch(e);
                }
            });
        } else {
            optParams = {
                ops: ops,
                groupId: item.id,
                groupType: item.isPrivate === "true" ? 1 : 0,
                addGroupModalVisible: true
            };
        }
        this.setOptParams(optParams);
    };

    @action
    setSignInput = (val) => {
        this.signinput = {...this.signinput,val}
    }
}